-- 血浸铁臂
local xuejintiebi = fk.CreateSkill {
    name = "mcdh_xuejintiebi",
    tags  ={Skill.Compulsory}
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

xuejintiebi:addEffect(fk.CardUsing,{
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(self) and U.IsUsingHandcard(player, data)
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local current = room.current
        local choices ={}
        if not current:isNude() then
            table.insert(choices, "#mcdh_xjtb_discard:"..current.id)
        end
        table.insert(choices, "#mcdh_xjtb_minusmaxcards:"..current.id)
        local choice = room:askForChoice(player,choices,self.name)
        if choice == "#mcdh_xjtb_discard:"..current.id then
            local cid = room:askForCardChosen(player, current, "he", self.name)
            room:throwCard({cid}, self.name, current, player)
        else
            room:addPlayerMark(current, MarkEnum.MinusMaxCardsInTurn, 1)
        end
    end
})

xuejintiebi:addEffect(fk.CardResponding,{
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(self) and U.IsUsingHandcard(player, data)
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local current = room.current
        local choices ={}
        if not current:isNude() then
            table.insert(choices, "#mcdh_xjtb_discard:"..current.id)
        end
        table.insert(choices, "#mcdh_xjtb_minusmaxcards:"..current.id)
        local choice = room:askForChoice(player,choices,self.name)
        if choice == "#mcdh_xjtb_discard:"..current.id then
            local cid = room:askForCardChosen(player, current, "he", self.name)
            room:throwCard({cid}, self.name, current, player)
        else
            room:addPlayerMark(current, MarkEnum.MinusMaxCardsInTurn, 1)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_xuejintiebi"] = "血臂",
    [":mcdh_xuejintiebi"] = "『血浸铁臂』<br>锁定技。当你使用或打出手牌时，你弃置当前回合角色一张牌，或令其本回合手牌上限-1。",
    ["#mcdh_xjtb_discard"] = "弃置 %src 一张牌",
    ["#mcdh_xjtb_minusmaxcards"] = "令 %src 手牌上限-1",
}

return xuejintiebi